package com.example.tool.activtiy;

import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.widget.TextView;

import com.example.tool.R;
import com.example.tool.activtiy.base.BaseActivity;
import com.example.tool.adapter.FontAdapter;
import com.example.tool.adapter.base.decoration.RecycleViewDivider;
import com.example.tool.mvp.CommonPresent;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;

/**
 * 描述: 字体演示
 *
 * @author: liangkun
 * @date: 2019/10/22 10:41
 */
public class FontActivity extends BaseActivity<CommonPresent> {
    @BindView(R.id.rv_home)
    protected RecyclerView recyclerView;
    @BindView(R.id.tv_title)
    protected TextView tvTitle;
    private LinearLayoutManager linearLayoutManager;
    private String[] strings;

    @Override
    protected int getLayoutId() {
        return R.layout.activity_main;
    }

    @Override
    protected void initView() {
        tvTitle.setText("字体样式");
        strings = getResources().getStringArray(R.array.font_type_array);
        linearLayoutManager = new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false);
        recyclerView.addItemDecoration(new RecycleViewDivider(this, LinearLayoutManager.VERTICAL,
                getResources().getDimensionPixelOffset(R.dimen.sw_dp_15), 0, 0, getResources().getColor(R.color.color_white)));
        recyclerView.setLayoutManager(linearLayoutManager);
        FontAdapter fontAdapter = new FontAdapter(R.layout.font_item, getData(),this);
        recyclerView.setAdapter(fontAdapter);
    }

    @Override
    protected void initData() {

    }

    @Override
    protected void initEvent() {

    }

    @Override
    protected CommonPresent createPresenter() {
        return null;
    }

    private List<String> getData() {
        List<String> list = new ArrayList<>();
        for (int i = 0; i < strings.length; i++) {
            list.add(strings[i]);
        }
        return list;
    }
}
